# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.FusionTables.V2.Model.StyleFunction do
  @moduledoc """
  Represents a StyleFunction within a StyleSetting

  ## Attributes

  *   `buckets` (*type:* `list(GoogleApi.FusionTables.V2.Model.Bucket.t)`, *default:* `nil`) - Bucket function that assigns a style based on the range a column value falls into.
  *   `columnName` (*type:* `String.t`, *default:* `nil`) - Name of the column whose value is used in the style.
  *   `gradient` (*type:* `GoogleApi.FusionTables.V2.Model.StyleFunctionGradient.t`, *default:* `nil`) - Gradient function that interpolates a range of colors based on column value.
  *   `kind` (*type:* `String.t`, *default:* `nil`) - Stylers can be one of three kinds: "fusiontables#fromColumn if the column value is to be used as is, i.e., the column values can have colors in #RRGGBBAA format or integer line widths or icon names; fusiontables#gradient if the styling of the row is to be based on applying the gradient function on the column value; or fusiontables#buckets if the styling is to based on the bucket into which the the column value falls.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :buckets => list(GoogleApi.FusionTables.V2.Model.Bucket.t()),
          :columnName => String.t(),
          :gradient => GoogleApi.FusionTables.V2.Model.StyleFunctionGradient.t(),
          :kind => String.t()
        }

  field(:buckets, as: GoogleApi.FusionTables.V2.Model.Bucket, type: :list)
  field(:columnName)
  field(:gradient, as: GoogleApi.FusionTables.V2.Model.StyleFunctionGradient)
  field(:kind)
end

defimpl Poison.Decoder, for: GoogleApi.FusionTables.V2.Model.StyleFunction do
  def decode(value, options) do
    GoogleApi.FusionTables.V2.Model.StyleFunction.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.FusionTables.V2.Model.StyleFunction do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
